function [ SelectedData,TestData ] = SelectData( data, numFromEachClass,numTestData)
    VEG = 1004;
    WIRE = 1100;
    POLE = 1103;
    GROUND = 1200;
    FACADE = 1400;
    
    [vr, ~] = find(data(:,5) == VEG, numFromEachClass(1), 'first');
    [wr, ~] = find(data(:,5) == WIRE, numFromEachClass(2), 'first');
    [pr, ~] = find(data(:,5) == POLE, numFromEachClass(3), 'first');
    [gr, ~] = find(data(:,5) == GROUND, numFromEachClass(4), 'first');
    [fr, ~] = find(data(:,5) == FACADE, numFromEachClass(5), 'first');
    
    SelectedData = [data(vr, :);data(wr,:);data(pr,:);data(gr,:);data(fr,:)];
    TestData = data;
    TestData(vr,:) = [];
    TestData(wr,:) = [];
    TestData(pr,:) = [];
    TestData(gr,:) = [];
    TestData(fr,:) = [];
    [vr, ~] = find(TestData(:,5) == VEG,round(numTestData/5), 'first');
    [wr, ~] = find(TestData(:,5) == WIRE,round(numTestData/5), 'first');
    [pr, ~] = find(TestData(:,5) == POLE,round(numTestData/5), 'first');
    [gr, ~] = find(TestData(:,5) == GROUND,round(numTestData/5), 'first');
    [fr, ~] = find(TestData(:,5) == FACADE,round(numTestData/5), 'first');
    TestData = [TestData(vr, :);TestData(wr,:);TestData(pr,:);TestData(gr,:);TestData(fr,:)];
end

